import 'package:flutter/material.dart';
import 'dart:math';

class AlertItem extends StatelessWidget {
  final String text;
  final Function func;
  AlertItem(this.text, this.func) : super();

  @override
  Widget build(BuildContext context) {
    Color bgColor = Color.fromRGBO(Random().nextInt(255), Random().nextInt(255), Random().nextInt(255), 1);
    return Listener(
      child: Container(
        alignment: Alignment.centerLeft,
        height: 40,
        child: Padding(
          padding: EdgeInsets.only(
            left: 18,
            right: 18
          ),
          child: Text(
            text,
            style: TextStyle(
              color: bgColor.computeLuminance() < 0.5 ? Colors.white : Colors.black
            ),
          ),
        ),
        color: bgColor,
      ),
      onPointerUp: (event) => func()
    );
  }
}
